home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / var / lib / dpkg / info / initscripts.postinst < prev    next >
Encoding:
Text File  |  2012-03-27  |  7.5 KB  |  278 lines

  1. #! /bin/sh
  2. #
  3. # initscripts postinst
  4. #
  5.  
  6. set -e
  7.  
  8. case "$1" in
  9.   configure)
  10.     PREV_VER=$2
  11.     ;;
  12.   abort-upgrade|abort-remove|abort-deconfigure)
  13.     exit 0
  14.     ;;
  15. esac
  16.  
  17. umask 022
  18.  
  19. chrooted() {
  20.   if [ -r /proc/1/root ]; then
  21.     return 1
  22.   fi
  23.   return 0
  24. }
  25.  
  26. #
  27. # Initialize rcS default file.
  28. #
  29. if [ ! -f /etc/default/rcS ]
  30. then
  31.     cp -p /usr/share/initscripts/default.rcS /etc/default/rcS
  32. fi
  33.  
  34. #
  35. # In 2.86.ds1-7 the "single" script was moved.
  36. # We have to remove the old links _before_ we install new ones.
  37. #
  38. if dpkg --compare-versions "$PREV_VER" lt "2.86.ds1-7"
  39. then
  40.     update-rc.d -f single remove >/dev/null
  41. fi
  42.  
  43. # In 2.86.ds1-16, the mtab.sh and hostname.sh scripts were moved.
  44. if dpkg --compare-versions "$PREV_VER" lt "2.86.ds1-16"
  45. then
  46.     update-rc.d -f mtab.sh remove >/dev/null
  47.     update-rc.d -f hostname.sh remove >/dev/null
  48. fi
  49.  
  50. # In 2.86.ds1-21, the sendsigs script were moved, and in 2.86.ds1-35
  51. # it was moved back.
  52. if dpkg --compare-versions "$PREV_VER" lt "2.86.ds1-35"
  53. then
  54.     update-rc.d -f sendsigs remove >/dev/null
  55. fi
  56.  
  57. #
  58. # In 2.87dsf-2 the "mountoverflowtmp" script was dropped
  59. # from runlevels 0 and 6.
  60. # We have to remove the old links _before_ we install new ones.
  61. #
  62. if dpkg --compare-versions "$PREV_VER" lt "2.87dsf-2" ; then
  63.     update-rc.d -f mountoverflowtmp remove >/dev/null
  64. fi
  65.  
  66. #
  67. # Okay, we could do this with update-rc.d, but that would probably
  68. # be pretty slow. This way we win some speed.
  69. # DO NOT FOLLOW THIS EXAMPLE IN OTHER PACKAGES.
  70. #
  71. # Links in runlevel S
  72. #
  73. update-rc.d mountkernfs.sh         start 02 S . >/dev/null || exit $?
  74. update-rc.d hostname.sh            start 02 S . >/dev/null || exit $?
  75. update-rc.d mountdevsubfs.sh       start 04 S . >/dev/null || exit $?
  76. update-rc.d bootlogd               start 05 S . >/dev/null || exit $?
  77. update-rc.d checkroot.sh           start 10 S . >/dev/null || exit $?
  78. update-rc.d mtab.sh                start 12 S . >/dev/null || exit $?
  79. update-rc.d checkfs.sh             start 30 S . >/dev/null || exit $?
  80. update-rc.d mountall.sh            start 35 S . >/dev/null || exit $?
  81. update-rc.d mountall-bootclean.sh  start 36 S . >/dev/null || exit $?
  82. update-rc.d mountoverflowtmp       start 37 S . >/dev/null || exit $?
  83. update-rc.d mountnfs.sh            start 45 S . >/dev/null || exit $?
  84. update-rc.d mountnfs-bootclean.sh  start 46 S . >/dev/null || exit $?
  85. update-rc.d bootmisc.sh            start 55 S . >/dev/null || exit $?
  86. update-rc.d urandom                start 55 S . start 30 0 6 . >/dev/null || exit $?
  87. #
  88. # Links in runlevels other than S
  89. #
  90. update-rc.d halt                   start 90 0 . >/dev/null || exit $?
  91. update-rc.d reboot                 start 90 6 . >/dev/null || exit $?
  92. update-rc.d umountroot             start 60 0 6 . >/dev/null || exit $?
  93. update-rc.d umountfs               start 40 0 6 . >/dev/null || exit $?
  94. update-rc.d umountnfs.sh           start 31 0 6 . >/dev/null || exit $?
  95. update-rc.d sendsigs               start 20 0 6 . >/dev/null || exit $?
  96.  
  97. update-rc.d killprocs              start 30 1 . >/dev/null || exit $?
  98. update-rc.d single                 start 90 1 . >/dev/null || exit $?
  99. update-rc.d bootlogs               start 70 1 2 3 4 5 . >/dev/null || exit $?
  100. update-rc.d rc.local               start 99 2 3 4 5 . >/dev/null || exit $?
  101. update-rc.d rmnologin              start 99 2 3 4 5 . >/dev/null || exit $?
  102. update-rc.d stop-bootlogd-single   start 99 S . >/dev/null || exit $?
  103. update-rc.d stop-bootlogd          start 99 2 3 4 5 . >/dev/null || exit $?
  104.  
  105. #
  106. # Remove scripts that were left behind by older glibc (<< 2.3.2.ds1-12)
  107. # versions. We have the same functionality in mount{kern,devsub}fs.sh 
  108. #
  109. #
  110. # In 2.86.ds1-10 the "mountvirtfs" script was replaced by
  111. # mountkernfs.sh and mountdevsubfs.sh.  It was removed completely in
  112. # 2.86.ds1-16.
  113. #
  114. for F in mountkernfs devpts.sh mountvirtfs
  115. do
  116.     rm -f /etc/init.d/$F
  117.     update-rc.d $F remove >/dev/null
  118. done
  119.  
  120. #
  121. # Create /var/run and /var/lock on the root partition to make sure
  122. # they are available when RAMRUN or RAMLOCK is enabled.
  123. # If mount fail (like in a vserver environment), just clean up and ignore
  124. # it.  The admins enabling RAMRUN and RAMLOCK will have to create the
  125. # directories themselves in this case.
  126. #
  127. if dpkg --compare-versions "$PREV_VER" lt "2.86.ds1-22" && ! chrooted
  128. then
  129.     # We need to quickly bind / to another location so we can make them
  130.     # just in case /var is a mountpoint or a symlink to one.
  131.     mkdir -p /.root
  132.     if mount -n --bind / /.root ; then
  133.         if [ -L /.root/var ] && [ ! -d /.root/var ] ; then
  134.             # No use trying if /var is a relative symlink.  It is not
  135.             # going to work.
  136.             :
  137.         else
  138.             mkdir -p /.root/var/run /.root/var/lock
  139.         fi
  140.         umount /.root
  141.     fi
  142.     rmdir /.root
  143. fi
  144.  
  145. #
  146. # When installing for the first time or upgrading from version before
  147. # 2.86.ds1-27, a reboot is needed to make the /lib/init/rw/ tmpfs
  148. # available.  Flag this using notify-reboot-required.  Not mounting it
  149. # here as it creates problem for debootstrap, vservers, pbuilder and
  150. # cowbuilder.
  151. #
  152. if dpkg --compare-versions "$PREV_VER" lt "2.86.ds1-27" \
  153.  && [ -x /usr/share/update-notifier/notify-reboot-required ]; then
  154.     /usr/share/update-notifier/notify-reboot-required
  155. fi
  156.  
  157. #
  158. # Create initial log files
  159. #
  160. [ "$PREV_VER" ] || chmod 755 /var/log/fsck || :
  161. for F in /var/log/dmesg /var/log/boot /var/log/fsck/checkroot /var/log/fsck/checkfs
  162. do
  163.     if [ ! -f "$F" ] && touch "$F" >/dev/null 2>&1
  164.     then
  165.         echo "(Nothing has been logged yet.)" >| "$F"
  166.         chown root:adm "$F"
  167.         chmod 640 "$F"
  168.     fi
  169. done
  170.  
  171. #
  172. # Set up nologin symlink so that dynamic-login-disabling will work
  173. # (when DELAYLOGIN is set to "yes")
  174. #
  175. if [ ! -L /etc/nologin ] && [ ! -e /etc/nologin ]
  176. then
  177.     rm -f /var/lib/initscripts/nologin
  178.     ln -s /var/lib/initscripts/nologin /etc/nologin
  179. fi
  180.  
  181. #
  182. # Set up motd stuff, putting variable file in /var/run/
  183. #
  184. if [ ! -f /etc/motd.tail ]
  185. then
  186.     if [ -f /etc/motd ]
  187.     then
  188.         sed 1d /etc/motd > /etc/motd.tail
  189.         [ -s /etc/motd.tail ] || rm -f /etc/motd.tail
  190.     fi
  191. fi
  192. if [ ! -f /var/run/motd ]
  193. then
  194.     if [ -f /etc/motd ]
  195.     then
  196.         cat /etc/motd > /var/run/motd
  197.     else
  198.         :>/var/run/motd
  199.     fi
  200. fi
  201. if [ ! -L /etc/motd ]
  202. then
  203.     [ -f /etc/default/rcS ] && . /etc/default/rcS
  204.     if [ "$EDITMOTD" = no ]
  205.     then
  206.         cat /var/run/motd > /etc/motd.static
  207.         ln -sf motd.static /etc/motd
  208.     else
  209.         ln -sf /var/run/motd /etc/motd
  210.     fi
  211. fi
  212.  
  213. #
  214. # Mount kernel virtual filesystems...not.
  215. # This causes problems in pbuilder.
  216. #
  217. #
  218. #if [ -x /etc/init.d/mountkernfs.sh ]
  219. #then
  220. #    if which invoke-rc.d >/dev/null 2>&1
  221. #    then
  222. #        invoke-rc.d mountkernfs.sh start || :
  223. #    else
  224. #        /etc/init.d/mountkernfs.sh start
  225. #    fi
  226. #fi
  227.  
  228. #
  229. # Create /dev/pts, /dev/shm directories
  230. #
  231. if [ "$(uname -s)" = Linux ]
  232. then
  233.     #
  234.     # Only create /dev/{pts,shm} if /dev is on the
  235.     # root file system. If some package has mounted a
  236.     # seperate /dev (ramfs from udev, devfs) it is
  237.     # responsible for the presence of those subdirs.
  238.     # (it is OK for these to fail under fakechroot)
  239.     #
  240.     if ! mountpoint -q /dev
  241.     then
  242.         [ -d /dev/pts ] || { mkdir --mode=755 /dev/pts ; chown root:root /dev/pts || [ "$FAKECHROOT" = true ]; }
  243.         [ -d /dev/shm ] || { mkdir --mode=755 /dev/shm ; chown root:root /dev/shm || [ "$FAKECHROOT" = true ]; }
  244.     fi
  245. fi
  246.  
  247. #
  248. # Create /etc/rc.local on first time install and when upgrading from
  249. # versions before "2.86.ds1-16"
  250. #
  251. if dpkg --compare-versions "$PREV_VER" lt "2.86.ds1-16"
  252. then
  253.     if [ ! -e /etc/rc.local ]; then
  254.         cat << EOF > /etc/rc.local
  255. #!/bin/sh -e
  256. #
  257. # rc.local
  258. #
  259. # This script is executed at the end of each multiuser runlevel.
  260. # Make sure that the script will "exit 0" on success or any other
  261. # value on error.
  262. #
  263. # In order to enable or disable this script just change the execution
  264. # bits.
  265. #
  266. # By default this script does nothing.
  267.  
  268. exit 0
  269. EOF
  270.         # make sure it's enabled by default.
  271.         chmod 755 /etc/rc.local
  272.     fi
  273. fi
  274.  
  275.  
  276.  
  277. :
  278.